/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO.Util;
import Pojo.*;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author An
 */
public class DeThisinhDaThiAdmin_DAO {
    

    public static ArrayList<CauHoi> LayCauHoiTrongDeThi(int madethi)
    {
        Dethi dt = DeThiDAO.LayThongTinDeThiTheoMaDe(madethi);
        ArrayList<CauHoi> dsch_dathi = new ArrayList<>();
        ArrayList<CauHoi> all_dsch = CauHoiDAO.layTatCaCauHoi();
        
        String kho = dt.getKho();
        String tb = dt.getTrungBinh();
        String de = dt.getDe();
        
        String skho[] = kho.split(",");
        String stb[] = tb.split(",");
        String sde[] = de.split(",");
        
        for(int i=0;i<skho.length;i++)
        {
            CauHoi cauhoi = all_dsch.get(Integer.parseInt(skho[i]));
            dsch_dathi.add(cauhoi);
        }
        for(int i=0;i<stb.length;i++)
        {
            CauHoi cauhoi = all_dsch.get(Integer.parseInt(stb[i]));
            dsch_dathi.add(cauhoi);
        }
        for(int i=0;i<sde.length;i++)
        {
            CauHoi cauhoi = all_dsch.get(Integer.parseInt(sde[i]));
            dsch_dathi.add(cauhoi);
        }
        return dsch_dathi;
    }

    

}
